package com.pktechan.api.enumeration;

public enum CloudPointBusinessTypeEnum {
     // 流水类型 10-生成 11-转入 20-消费  21-转出',
//    GENERATE(10, "生成"),
//    TRANSFER_INTO(11, "转入"),
//    CONSUMPTION(20, "消费"),
//    TRANSFER_OUT(21, "转出");

//    20240604重新定义业务代码
    GENERATE(1, "生成"),
    CONSUMPTION(-1, "消费"),
    TRANSFER_INTO(2, "转入"),
    TRANSFER_OUT(-2, "转出"),
    SYS_AWARD(3, "系统奖励"),
    SYS_DEDUCT(-3, "系统罚没");

    private Integer code;
    private String name;

    CloudPointBusinessTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    /**
     * 根据状态代码获得状态名称
     *
     * @param code 状态代码
     * @return 状态名称
     */
    public static String getNameByCode(Integer code) {
        for (CloudPointBusinessTypeEnum typeEnum : CloudPointBusinessTypeEnum.values()) {
            if (typeEnum.code.equals(code)) {
                return typeEnum.name;
            }
        }
        return null;
    }
}
